package com.wwdx.service.impl.upms;

import com.google.common.collect.Maps;
import com.wwdx.model.upms.UpmsUser;
import com.wwdx.service.impl.BaseServiceImpl;
import com.wwdx.service.upms.UpmsUserServiceI;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author liguoliang
 * @date 2018/2/9 17:25
 */
@Service
public class UpmsUserServiceImpl extends BaseServiceImpl<UpmsUser> implements UpmsUserServiceI {

    private String getParams(UpmsUser model, Map<String, Object> params){
        StringBuilder sb = new StringBuilder("where 1=1\n");
        return sb.toString();
    }

    @Override
    public Long selectModelCount(UpmsUser model) {
        Map<String, Object> params = Maps.newHashMapWithExpectedSize(4);
        String hql = "select count(1) from UpmsUser\t"+getParams(model,params);
        return this.count(hql,params);
    }

    @Override
    public List<UpmsUser> selectModelList(UpmsUser model, Integer page, Integer rows) {
        Map<String, Object> params = Maps.newHashMapWithExpectedSize(4);
        String hql = "from UpmsUser\t"+getParams(model,params);
        return this.find(hql,params,page,rows);
    }
}